<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
<div class="container config-modulel7-contianer">
	<div class="control-group">
		<div>
			<button class="u-btn-blue modulel7-add" {{action "openDialog" "1"}}>添加模块</button>
		</div>
	</div>
	
	<div class="tab-content">
		<table class="conf-table conf-modulel7-tab">
			<tr>
				<th class="config-modulel7-tab1">
					L7代号
				</th>
				<th class="config-modulel7-tab3">
					模块名称
				</th>
				<th class="config-modulel7-tab1">
					版本
				</th>
				<th class="config-modulel7-tab1">
					状态
				</th>
				<th class="config-modulel7-tab4">
					用途
				</th>
				<th class="config-modulel7-tab5">
					更新时间
				</th>
				<th class="config-modulel7-tab4">
					操作
				</th>
			</tr>
			{{#each modules as |module|}}
			<tr>
				<td class="config-tab-td">
					{{module.l7_proto}}
				</td>
				<td class="config-tab-td">
					{{module.name}}
				</td>
				<td class="config-tab-td">
					{{module.version}}
				</td>
				<td class="config-tab-td">
					{{#if module.status}}
						禁用
					{{else}}
						启用
					{{/if}}		
				</td>
				<td class="config-tab-td1">
					{{module.memo}}
				</td>
				<td class="config-tab-td">
					{{module.time}}
				</td>
				<td class="config-tab-td config-tab-option">		
					<button class="u-btn-blue op-code" {{action "setOpenDialog" module.l7_proto}} title="设置返回码">返回码</button>
					{{#if module.status}}
					<button class="u-btn-blue" {{action "enableCtr" module.id module.status}} title="启用">启用</button>
					{{else}}
					<button class="u-btn-blue" {{action "enableCtr" module.id module.status}} title="禁用">禁用</button>
					{{/if}}
					<button class="u-btn-blue" {{action "leadOut" module}} title="导出">导出</button>
					{{#if module.show}}
					<button class="u-btn-danger" {{action "deleteModule" module.id module.status}} title="删除">删除</button>
					{{/if}}
				</td>
			</tr>
		{{/each}}
	  	</table>
	</div>
	<iframe name="paramIframe" style="DISPLAY: none" height="0px" width="0px"></iframe>
</div>

{{#view view.Dialog
	id="modulel7_add1"
	title="添加模块"
	class="config-modulel7-dialog1 hide modulel7-addmodule"
	autoOpen=false
	width=400
	height=250
	modal=true
	buttons=dialogButtons}}
	<div>
		<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
		<form enctype="multipart/form-data" name="ssoForm" id="ssoForm" method="POST" action="/front/rest/apm/configs/upload" target="paramIframe">
			<div class="control-group">
				<label class="control-label">请上传.mod格式模块文件:</label>
				<div class="controls mt10">
					<div class="fileControls">
					  <input type="file" id="File" name="soFile" value="form.soFile" onChange="document.getElementById('FileText').value = this.value;"   />
					</div>
					<input type="text"  id="FileText" class="u-input-blue"/>
					<span class="input-group-btn">
		              <button class="u-btn-blue scan" onclick="document.getElementById('File').click();">浏 览</button>
		            </span>
				</div>
			</div>
			<div class="control-group mt20">
				<div class="controls">
					<button type="button" {{action "uploadModule"}} class="u-btn-blue">上传</button>
					<button type="button" {{action "closeDialog" "1"}} class="u-btn-blue">取消</button>
				</div>
			</div>
		</form>	
	</div>	
{{/view}}

{{#view view.Dialog
	id="modulel7_add2"
	title="添加Lua模块"
	width=760
	height=680
	class="hide"
	autoOpen=false
	modal=true
	buttons=dialogButtons}}
	<div>
		<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
		<form enctype="multipart/form-data" name="luaForm" id="luaForm">
			<div class="control-group">
				<label class="control-label">模块名称:</label>
				<div class="controls">
						{{input class="input span9" value=form.soFile}}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">L7代号:</label>
				<div class="controls">
						{{input class="input span9" value=form.L7}}
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">代码编辑器:</label>
				<div class="controls">
						{{textarea cols="100" rows="20" value=form.soFile}}
				</div>
			</div>
			<div class="control-group">
				<div class="controls">
					<button type="submit" {{action "addLuaModule"}} class="btn btn-primary">添加</button>
					<button type="button" {{action "closeDialog" "2"}} class="btn">取消</button>
				</div>
			</div>
		</form>	
	</div>	
{{/view}}

{{#view view.Dialog
	id="modulel7_add3"
	title="设置返回码"
	width=604
	height=600
	class="hide modulel7-setcode"
	autoOpen=false
	modal=false
	resizable=false
	draggable=false
	buttons=dialogButtons}}
	{{!-- <div> --}}

	<div class="setcode-options">
		{{!-- <button type="button" class="u-btn-blue">批量设置</button>
		{{action "openDialog" "1"}} --}}
		{{!-- <button type="button" class="u-btn-blue">批量删除</button> --}}
		<button class="u-btn-blue" {{action "openDialog" "5"}}>添加</button>
	</div>
	<div {{bind-attr class=":alert alertType saveResult::hide"}}><strong>{{saveResult}}</strong></div>
	<div class="apm-gridcontaine">
    	{{view view.parentView.Grid
		columns=gridColumns
		content=codeArrys
		allowSorting=true
		sorted="gridSorted"}}
	</div>
	{{!-- <div class="row" id="modulel7_add3_save">
			<div class="span8">
				<div class="controls">
					&nbsp;&nbsp;<button type="submit" {{action "openDialog" "5"}} class="u-btn-blue">添加</button>
					<button type="button" {{action "queryModeCode"}} class="u-btn-blue">刷新</button>
				</div>
			</div>
	</div> --}}
{{/view}}

{{#view view.Dialog
	id="modulel7_add4"
	title="修改返回码"
	width=500
	height=460
	class="hide modulel7-editcode common-popUp"
	autoOpen=false
	modal=true
	resizable=false
	buttons=dialogButtons}}
	<div>
		<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
		<form enctype="multipart/form-data" name="luaForm" id="luaForm">
			<div class="control-group">
				<label class="group-title">返回码:</label>
				<div class="group-content">
						{{input class="input u-input-blue span4" value=form.code  readonly=true}}
				</div>
			</div>
			<div class="control-group">
				<label class="group-title">状态码:</label>
				<div class="group-content statusCode">
					{{!-- {{view "select"
						class="span4 u-input-blue"
						content=modCodeStatus
						optionLabelPath="content.name"
						optionValuePath="content.code"
						value=form.mstatus}} --}}

					{{view view.parentView.select 
						class="form-top-select form-top-select-app span4"
						content=modCodeStatus
						selectValue=form.mstatus
						currentValue=currentValue
						optionLabelPath="name"
						optionValuePath="code"
					}} 
				</div>
			</div>
			<div class="control-group">
				<label class="group-title">返回码信息:</label>
				<div class="group-content">
						{{textarea class="u-input-blue" placeholder="请输入文字" cols="48" rows="7" value=form.errorMessage}}
				</div>
			</div>
			<div class="control-group">
				<div class="group-content editcode-options">
				<button type="submit" {{action "updaddModCode"}} class="u-btn-blue editcode-save">保存</button>
					<button type="button" {{action "closeDialog" "4"}} class="u-btn-blue editcode-cancel">取消</button>
				</div>
			</div>
		</form>	
	</div>	
{{/view}}

{{#view view.Dialog
	id="modulel7_add5"
	title="添加返回码"
	width=500
	height=460
	class="hide modulel7-addcode common-popUp"
	autoOpen=false
	modal=true
	resizable=false
	buttons=dialogButtons}}
	<div>
		<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
		<form enctype="multipart/form-data" name="luaForm" id="luaForm">
			<div class="control-group">
				<label class="group-title">返回码:</label>
				<div class="group-content">
						{{input class="input u-input-blue span4" value=form.code}}
				</div>
			</div>
			<div class="control-group">
				<label class="group-title">状态码:</label>
				<div class="group-content statusCode">
					{{!-- {{view "select"
						class="u-input-blue span4"
						content=modCodeStatus
						optionLabelPath="content.name"
						optionValuePath="content.code"
						value=form.mstatus}} --}}
				{{view view.parentView.select 
					class="form-top-select form-top-select-app span4"
					content=modCodeStatus
					selectValue=form.mstatus
					optionLabelPath="name"
					optionValuePath="code"
				}} 
				</div>
			</div>
			<div class="control-group">
				<label class="group-title">返回码信息:</label>
				<div class="group-content">
						{{textarea cols="39" class="u-input-blue" rows="6" value=form.errorMessage}}
				</div>
			</div>
			<div class="control-group">
				<div class="group-content">
				<button type="submit" {{action "addModeCode"}} class="u-btn-blue">保存</button>
					<button type="button" {{action "closeDialog" "5"}} class="u-btn-blue">取消</button>
				</div>
			</div>
		</form>	
	</div>	
{{/view}}